package se.schtohan.model;

import java.util.HashMap;

public class ShoppingCart {

    private HashMap<Book, Integer> books;

    public ShoppingCart() {
        books = new HashMap<Book, Integer>();
    }

    public HashMap<Book, Integer> getBooks() {
        return books;
    }

    public void setBooks(HashMap<Book, Integer> books) {
        this.books = books;
    }

    public void addBook(Book book) {
        if(books.containsKey(book)) {
            int currentNo = books.get(book);
            books.put(book, ++currentNo);
        } else {
            books.put(book, 1);
        }
    }
}
